package com.aspire.boc.mms.gwcmp.test;

import static org.junit.Assert.fail;

import java.util.Map;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;

import com.aspire.boc.mms.gwcmp.action.ProductAct;
import com.aspire.boc.mms.gwcmp.test.base.BaseTest;

public class ProductActTest1 extends BaseTest {

	@Autowired
	private ProductAct productAct;
	
	@Test
	public void testGetProductList() {
		System.out.println("##### begin # execute ProductActTest.getList");
    	//需要调用的方法
    	
	    Map<String,Object> map	=productAct.getProductList("1", "测试", "", 0, 20, request, response);
     	System.out.println("##### end # execute ProductActTest.getList");
     	System.out.println("map"+map);
	}

	@Test
	public void testGetNoOccupiedProductList() {
		System.out.println("##### begin # execute ProductActTest.getList");
    	//需要调用的方法
    	
	    Map<String,Object> map	=productAct.getNoOccupiedProductList("", request, response);
     	System.out.println("##### end # execute ProductActTest.getList");
     	System.out.println("map"+map);
	}

	@Test
	public void testGetProductDetail() {
		System.out.println("##### begin # execute ProductActTest.getList");
    	//需要调用的方法   	
	    Map<String, Object> p=productAct.getProductDetail("", request, response);
     	System.out.println("##### end # execute ProductActTest.getList");
     	System.out.println("GwcmpProduct"+p);
	}

	@Test
	public void testSaveProduct() {
		System.out.println("##### begin # execute testSaveProduct");
    	for (int i = 0; i < 30; i++) {
    		//需要调用的方法   	
    		String id="";
    		String productName="测试_"+i;
    		String ecId="10001";
    		short serviceType=1;
    		short businessType=1;
    		String cmccChannelId="";
    		
    		String cmccChannelSrcid="";
    		String cmccChannelExtParams="";
    		String unicomChannelId="";
    		
    		String unicomChannelSrcid="";
    		
    		String unicomChannelExtParams="";
    		String telcomChannelId="";
    		String telcomChannelSrcid="";
    		String telcomChannelExtParams="";
    		short priority=1;
    		short needAudit=1;
    		ResponseEntity<String> p=productAct.saveProduct(id, productName, ecId, serviceType, businessType, cmccChannelId, cmccChannelSrcid, cmccChannelExtParams, unicomChannelId, unicomChannelSrcid, unicomChannelExtParams, telcomChannelId, telcomChannelSrcid, telcomChannelExtParams, priority, needAudit, request, response);
    		System.out.println("GwcmpProduct"+p);
		}
		
     	
	    System.out.println("##### end # execute testSaveProduct");
	}

	@Test
	public void testChangeProductStatus() {
		System.out.println("##### begin # execute ProductActTest.getList");
		int i=10037;
		StringBuffer sb=new StringBuffer();
		for (; i < 10037+30; i++) {
			sb.append(i+",");
		}
		System.out.println(sb.toString());
		String productIds=sb.toString();
		short ii=0;
		ResponseEntity<String> pp=productAct.changeProductStatus(productIds, ii, request, response);
		System.out.println("##### end # execute ProductActTest.getList"+pp);
	}

	@Test
	public void testBatchEditProducts() {
		fail("Not yet implemented");
	}

}
